import Cookies from 'js-cookie'

const TokenKey = 'leju-admin-token'
const UserInfo = 'UserInfo'

export function getToken() {
  return JSON.parse(localStorage.getItem(TokenKey))
}

export function setToken(token) {
  return localStorage.setItem(TokenKey, JSON.stringify(token))
}

export function removeToken() {
  return localStorage.removeItem(TokenKey)
}

export function getUserInfo() {
  return JSON.parse(localStorage.getItem(UserInfo))
}

export function setUserInfo(token) {
  return localStorage.setItem(UserInfo, JSON.stringify(token))
}

export function removeUserInfo() {
  return localStorage.removeItem(UserInfo)
}
